
package com.ostrich.manpower.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ostrich.manpower.bean.TostHrBaseinfo;
import com.ostrich.manpower.bean.TostHrDeductinfo;
import com.ostrich.manpower.bean.TostHrDepartinfo;
import com.ostrich.manpower.bean.TostHrFactpayinfo;
import com.ostrich.manpower.bean.TostHrSalaryinfo;
import com.ostrich.manpower.bean.TostHrSubsalaryinfo;
import com.ostrich.system.bean.TostSysParaminfo;
import com.ostrich.system.service.impl.TostSysParaminfoService;
/**
 * @author wangyinan
 * @brief    模块功能简单描述
 * @details  模块功能详细描述
 */
@Service("tostHrSalaryinfoTService")
public class TostHrSalaryinfoTService  {
	private final static Logger log= Logger.getLogger(TostHrSalaryinfoTService.class);

	@Autowired
	TostHrSalaryinfoService<TostHrSalaryinfo> salaryservice;
	@Autowired
	TostHrSubsalaryinfoService<TostHrSubsalaryinfo> subsalaryinfoservice;
	@Autowired
	TostHrDeductinfoService<TostHrDeductinfo> hrdeductinfoservice;
	@Autowired
	TostHrFactpayinfoService<TostHrFactpayinfo> hrfactpayinfoservice;
	@Autowired
	TostHrBaseinfoService<TostHrBaseinfo> tostHrBaseinfoService;
	@Autowired
	TostHrDepartinfoService<TostHrDepartinfo> tostHrDepartinfoService;
	@Autowired
	TostSysParaminfoService<TostSysParaminfo> tostSysParaminfoService;
	
	
	public List<TostHrSalaryinfo> getSalaryAllByHrid(Integer hrid){
		return  salaryservice.queryByHrid(hrid);
	}
	
	public List<TostHrSalaryinfo> getAalaryAll(TostHrSalaryinfo tostHrSalaryinfo) throws Exception{
		return salaryservice.queryByMap(tostHrSalaryinfo);
	}
	
	
	public Map<String,Object> getHrSalaryById(Integer id) throws Exception{
		Map<String,Object> salary = new HashMap<String,Object>();
		//查询工资工资表
		TostHrSalaryinfo sa =  salaryservice.queryById(id);
		salary.put("salary", sa);
		if(sa!=null){
			//基础表
			TostHrBaseinfo hr = tostHrBaseinfoService.queryById(sa.getHrId());
				salary.put("baseinfo", hr);
			//部门
			TostHrDepartinfo de = tostHrDepartinfoService.queryById(hr.getHrDepart());
				salary.put("depart", de);
			//公司
			TostSysParaminfo co = tostSysParaminfoService.queryById(hr.getHrCompany());	
				salary.put("company", co);
			// 查询补贴表
			TostHrSubsalaryinfo sb = subsalaryinfoservice.queryById(sa.getHsuId());
				salary.put("subsalary", sb);
			//查询扣款表
			TostHrDeductinfo du = hrdeductinfoservice.queryById(sa.getHdeId());
				salary.put("deduct", du);
			//应付表
			TostHrFactpayinfo hf = hrfactpayinfoservice.queryById(sa.getHfaId());
				salary.put("factpay", hf);
		}
		return salary;
	}

}
